﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Xml.Serialization;

namespace AssignmentsManage.DataClasses
{
    [XmlRootAttribute(ElementName = "ActivityTypeWorthItem", IsNullable = false)]
    public class ActivityTypeWorth : INotifyPropertyChanged
    {
        #region Contstructors

        public ActivityTypeWorth()
        { }

        public ActivityTypeWorth(EnumInfo.ActivityType activityType)
        {
            ActivityType = activityType;
        }

        public ActivityTypeWorth(EnumInfo.ActivityType activityType, double worth)
            : this(activityType)
        {
            Worth = worth;
        }

        #endregion

        #region Properties

        private EnumInfo.ActivityType _ActivityType;
        [XmlElementAttribute("ActivityType")]
        public EnumInfo.ActivityType ActivityType
        {
            get
            {
                return _ActivityType;
            }
            set
            {
                _ActivityType = value;
                OnPropertyChanged("ActivityType");
            }
        }

        private double _Worth = 0;
        [XmlElementAttribute("Worth")]
        public double Worth
        {
            get
            {
                return _Worth;
            }
            set
            {
                _Worth = value;
                OnPropertyChanged("Worth");
            }
        }

        #endregion

        #region NotifyChanges

        // Create the OnPropertyChanged method to raise the event
        protected void OnPropertyChanged(string name)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(name));
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        #endregion
    }
}
